Optimal. Leaf size=159 \[ \frac {(i A+B) \tanh ^{-1}\left (\frac {\sqrt {a+i a \tan (c+d x)}}{\sqrt {2} \sqrt {a}}\right )}{\sqrt {2} \sqrt {a} d}+\frac {(i A-B) \tan ^2(c+d x)}{d \sqrt {a+i a \tan (c+d x)}}-\frac {4 (i A-B) \sqrt {a+i a \tan (c+d x)}}{a d}+\frac {(3 i A-5 B) (a+i a \tan (c+d x))^{3/2}}{3 a^2 d} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.22, antiderivative size = 159, normalized size of antiderivative = 1.00, number of steps
used = 5, number of rules used = 5, integrand size = 36, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.139, Rules used = {3676, 3673,
3608, 3561, 212} \begin {gather*} \frac {(-5 B+3 i A) (a+i a \tan (c+d x))^{3/2}}{3 a^2 d}+\frac {(-B+i A) \tan ^2(c+d x)}{d \sqrt {a+i a \tan (c+d x)}}-\frac {4 (-B+i A) \sqrt {a+i a \tan (c+d x)}}{a d}+\frac {(B+i A) \tanh ^{-1}\left (\frac {\sqrt {a+i a \tan (c+d x)}}{\sqrt {2} \sqrt {a}}\right )}{\sqrt {2} \sqrt {a} d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 212
Rule 3561
Rule 3608
Rule 3673
Rule 3676
Rubi steps
\begin {align*} \int \frac {\tan ^2(c+d x) (A+B \tan (c+d x))}{\sqrt {a+i a \tan (c+d x)}} \, dx &=\frac {(i A-B) \tan ^2(c+d x)}{d \sqrt {a+i a \tan (c+d x)}}-\frac {\int \tan (c+d x) \sqrt {a+i a \tan (c+d x)} \left (2 a (i A-B)+\frac {1}{2} a (3 A+5 i B) \tan (c+d x)\right ) \, dx}{a^2}\\ &=\frac {(i A-B) \tan ^2(c+d x)}{d \sqrt {a+i a \tan (c+d x)}}+\frac {(3 i A-5 B) (a+i a \tan (c+d x))^{3/2}}{3 a^2 d}-\frac {\int \sqrt {a+i a \tan (c+d x)} \left (-\frac {1}{2} a (3 A+5 i B)+2 a (i A-B) \tan (c+d x)\right ) \, dx}{a^2}\\ &=\frac {(i A-B) \tan ^2(c+d x)}{d \sqrt {a+i a \tan (c+d x)}}-\frac {4 (i A-B) \sqrt {a+i a \tan (c+d x)}}{a d}+\frac {(3 i A-5 B) (a+i a \tan (c+d x))^{3/2}}{3 a^2 d}-\frac {(A-i B) \int \sqrt {a+i a \tan (c+d x)} \, dx}{2 a}\\ &=\frac {(i A-B) \tan ^2(c+d x)}{d \sqrt {a+i a \tan (c+d x)}}-\frac {4 (i A-B) \sqrt {a+i a \tan (c+d x)}}{a d}+\frac {(3 i A-5 B) (a+i a \tan (c+d x))^{3/2}}{3 a^2 d}+\frac {(i A+B) \text {Subst}\left (\int \frac {1}{2 a-x^2} \, dx,x,\sqrt {a+i a \tan (c+d x)}\right )}{d}\\ &=\frac {(i A+B) \tanh ^{-1}\left (\frac {\sqrt {a+i a \tan (c+d x)}}{\sqrt {2} \sqrt {a}}\right )}{\sqrt {2} \sqrt {a} d}+\frac {(i A-B) \tan ^2(c+d x)}{d \sqrt {a+i a \tan (c+d x)}}-\frac {4 (i A-B) \sqrt {a+i a \tan (c+d x)}}{a d}+\frac {(3 i A-5 B) (a+i a \tan (c+d x))^{3/2}}{3 a^2 d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 2.23, size = 147, normalized size = 0.92 \begin {gather*} \frac {\left ((i A+B) \sqrt {1+e^{2 i (c+d x)}} \sinh ^{-1}\left (e^{i (c+d x)}\right )+\frac {1}{3} \sec (c+d x) (9 (-i A+B)+(-9 i A+5 B) \cos (2 (c+d x))+(6 A+2 i B) \sin (2 (c+d x)))\right ) (A+B \tan (c+d x))}{2 d (A \cos (c+d x)+B \sin (c+d x)) \sqrt {a+i a \tan (c+d x)}} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.11, size = 127, normalized size = 0.80
method | result | size |
derivativedivides | \(-\frac {2 i \left (-\frac {i B \left (a +i a \tan \left (d x +c \right )\right )^{\frac {3}{2}}}{3}+i a B \sqrt {a +i a \tan \left (d x +c \right )}+a A \sqrt {a +i a \tan \left (d x +c \right )}-\frac {a^{\frac {3}{2}} \left (-i B +A \right ) \sqrt {2}\, \arctanh \left (\frac {\sqrt {a +i a \tan \left (d x +c \right )}\, \sqrt {2}}{2 \sqrt {a}}\right )}{4}+\frac {a^{2} \left (i B +A \right )}{2 \sqrt {a +i a \tan \left (d x +c \right )}}\right )}{d \,a^{2}}\) | \(127\) |
default | \(-\frac {2 i \left (-\frac {i B \left (a +i a \tan \left (d x +c \right )\right )^{\frac {3}{2}}}{3}+i a B \sqrt {a +i a \tan \left (d x +c \right )}+a A \sqrt {a +i a \tan \left (d x +c \right )}-\frac {a^{\frac {3}{2}} \left (-i B +A \right ) \sqrt {2}\, \arctanh \left (\frac {\sqrt {a +i a \tan \left (d x +c \right )}\, \sqrt {2}}{2 \sqrt {a}}\right )}{4}+\frac {a^{2} \left (i B +A \right )}{2 \sqrt {a +i a \tan \left (d x +c \right )}}\right )}{d \,a^{2}}\) | \(127\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.51, size = 134, normalized size = 0.84 \begin {gather*} -\frac {i \, {\left (3 \, \sqrt {2} {\left (A - i \, B\right )} a^{\frac {5}{2}} \log \left (-\frac {\sqrt {2} \sqrt {a} - \sqrt {i \, a \tan \left (d x + c\right ) + a}}{\sqrt {2} \sqrt {a} + \sqrt {i \, a \tan \left (d x + c\right ) + a}}\right ) - 8 i \, {\left (i \, a \tan \left (d x + c\right ) + a\right )}^{\frac {3}{2}} B a + 24 \, \sqrt {i \, a \tan \left (d x + c\right ) + a} {\left (A + i \, B\right )} a^{2} + \frac {12 \, {\left (A + i \, B\right )} a^{3}}{\sqrt {i \, a \tan \left (d x + c\right ) + a}}\right )}}{12 \, a^{3} d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [B] Both result and optimal contain complex but leaf count of result is larger than twice
the leaf count of optimal. 391 vs. \(2 (127) = 254\).
time = 1.83, size = 391, normalized size = 2.46 \begin {gather*} -\frac {3 \, \sqrt {2} {\left (a d e^{\left (3 i \, d x + 3 i \, c\right )} + a d e^{\left (i \, d x + i \, c\right )}\right )} \sqrt {-\frac {A^{2} - 2 i \, A B - B^{2}}{a d^{2}}} \log \left (-\frac {4 \, {\left ({\left (-i \, A - B\right )} a e^{\left (i \, d x + i \, c\right )} + {\left (a d e^{\left (2 i \, d x + 2 i \, c\right )} + a d\right )} \sqrt {\frac {a}{e^{\left (2 i \, d x + 2 i \, c\right )} + 1}} \sqrt {-\frac {A^{2} - 2 i \, A B - B^{2}}{a d^{2}}}\right )} e^{\left (-i \, d x - i \, c\right )}}{i \, A + B}\right ) - 3 \, \sqrt {2} {\left (a d e^{\left (3 i \, d x + 3 i \, c\right )} + a d e^{\left (i \, d x + i \, c\right )}\right )} \sqrt {-\frac {A^{2} - 2 i \, A B - B^{2}}{a d^{2}}} \log \left (-\frac {4 \, {\left ({\left (-i \, A - B\right )} a e^{\left (i \, d x + i \, c\right )} - {\left (a d e^{\left (2 i \, d x + 2 i \, c\right )} + a d\right )} \sqrt {\frac {a}{e^{\left (2 i \, d x + 2 i \, c\right )} + 1}} \sqrt {-\frac {A^{2} - 2 i \, A B - B^{2}}{a d^{2}}}\right )} e^{\left (-i \, d x - i \, c\right )}}{i \, A + B}\right ) + 2 \, \sqrt {2} {\left ({\left (15 i \, A - 7 \, B\right )} e^{\left (4 i \, d x + 4 i \, c\right )} + 18 \, {\left (i \, A - B\right )} e^{\left (2 i \, d x + 2 i \, c\right )} + 3 i \, A - 3 \, B\right )} \sqrt {\frac {a}{e^{\left (2 i \, d x + 2 i \, c\right )} + 1}}}{12 \, {\left (a d e^{\left (3 i \, d x + 3 i \, c\right )} + a d e^{\left (i \, d x + i \, c\right )}\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \frac {\left (A + B \tan {\left (c + d x \right )}\right ) \tan ^{2}{\left (c + d x \right )}}{\sqrt {i a \left (\tan {\left (c + d x \right )} - i\right )}}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 7.67, size = 188, normalized size = 1.18 \begin {gather*} -\frac {A\,1{}\mathrm {i}}{d\,\sqrt {a+a\,\mathrm {tan}\left (c+d\,x\right )\,1{}\mathrm {i}}}+\frac {B}{d\,\sqrt {a+a\,\mathrm {tan}\left (c+d\,x\right )\,1{}\mathrm {i}}}-\frac {A\,\sqrt {a+a\,\mathrm {tan}\left (c+d\,x\right )\,1{}\mathrm {i}}\,2{}\mathrm {i}}{a\,d}+\frac {2\,B\,\sqrt {a+a\,\mathrm {tan}\left (c+d\,x\right )\,1{}\mathrm {i}}}{a\,d}-\frac {2\,B\,{\left (a+a\,\mathrm {tan}\left (c+d\,x\right )\,1{}\mathrm {i}\right )}^{3/2}}{3\,a^2\,d}-\frac {\sqrt {2}\,A\,\mathrm {atan}\left (\frac {\sqrt {2}\,\sqrt {a+a\,\mathrm {tan}\left (c+d\,x\right )\,1{}\mathrm {i}}}{2\,\sqrt {-a}}\right )\,1{}\mathrm {i}}{2\,\sqrt {-a}\,d}-\frac {\sqrt {2}\,B\,\mathrm {atan}\left (\frac {\sqrt {2}\,\sqrt {a+a\,\mathrm {tan}\left (c+d\,x\right )\,1{}\mathrm {i}}\,1{}\mathrm {i}}{2\,\sqrt {a}}\right )\,1{}\mathrm {i}}{2\,\sqrt {a}\,d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________